package com.example.juc.cas;

import com.example.juc.pc.A;

import java.util.concurrent.atomic.AtomicInteger;

public class CASDemo {
    public static void main(String[] args) {
        AtomicInteger num = new AtomicInteger(2020);
        // public final boolean compareAndSet(int expect, int update)
        // 期望着，更新值
        num.compareAndSet(2020,2021);
        System.out.println(num.get());
    }
}
